package com.bnz.controller;

import com.bnz.pojo.R;
import com.bnz.pojo.Student;
import com.bnz.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/student")
@RestController
public class StudentController {
    @Autowired
    private StudentService studentService;
    @RequestMapping("/list")
    // 1. 查询所有学生
    public R findAll(){
        List<Student> students = studentService.findAll();
        return R.ok().put("students",students);
    }
}
